﻿using System;
using System.Linq;
using Icms.Core.Model;
using Icms.Core.Repository;

namespace Icms.Data
{
    public class CaseRepo : Repo<Case>, ICaseRepo
    {
        public CaseRepo(IDbContextFactory f)
            : base(f)
        {
        }

        public int GetMinNumberInYear(int year, Guid courtid)
        {
            return Where(o => o.CreatedDate.Year == year && o.CourtId==courtid).Min(o => o.RowRank);
        }
    }
}